home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 051-075 / scopedisk56 / rmand / mand.doc < prev    next >
Text File  |  1995-03-19  |  7KB  |  181 lines

  1.  
  2. MAND - a program to display the Mandelbrot set
  3. ==============================================
  4.  
  5. *** WARNING *** *** WARNING *** *** WARNING ***
  6.  
  7.  - If you run this program from CLI, make sure the stack is set
  8.    to at least 20,000. Otherwise you will meet the GURU. 
  9.  
  10. *** WARNING *** *** WARNING *** *** WARNING ***
  11. =================================================================
  12.  
  13. Introduction:
  14. ------------
  15.  
  16.   I know there are plenty of Mandelbrot programs for the Amiga, but I
  17. wanted to add another one to the collection. The main purpose of this
  18. program is to speed up the computation of the Mandelbrot set,
  19. especially when the iteration counts are high and there is a lot of
  20. "black" on the screen (the "black" represents the points within the
  21. set). 
  22.  
  23.   To accomplish this a recursive algorithm is used. This algorithm was
  24. invented by Peter Trei, whose hobby is to think of recursion
  25. (Remember: "To iterate is human, to recurse divine!"). Although, Peter
  26. thought of his algorithm over a year ago, it took us until now to
  27. write all the code to make this program presantable.  Peter wrote most
  28. of the module that draws the set, I wrote the rest. 
  29.  
  30.   I know that other people thought of a similar algorithm, in fact one
  31. is mentioned in the Feb/89 issue of Scientific American, but Peter
  32. made up his algorithm without hearing about any of this. 
  33.  
  34. Peter's Algorithm:
  35. -----------------
  36.  
  37.   The basic idea behind Peter's algorithm is this:
  38.  
  39.    - compute the values for the Mandelbrot function around the
  40.      boundary of a rectangle (start with the whole screen)
  41.  
  42.    - if the color of the boundary is all the same, fill the
  43.      rectangle with that color, and go to the next rectangle
  44.  
  45.    - if more than one color occurs on the boundary, then
  46.      divide the rectangle into two smaller rectangles and
  47.      apply the algorithm to them
  48.  
  49.    - finally, if the rectangle gets small enough and its boundary
  50.      is still not solid, just go back to the old pixel-by-pixel
  51.      algorithm.
  52.  
  53. Cycle detection:
  54. ---------------
  55.  
  56.    As you know, while testing a particular point in the plane for
  57. membership in the Mandelbrot set, we go through iteration during
  58. which a positive real number is computed. If this number stays
  59. small, then there is a chance that the point in question lies in the
  60. set. If the number becomes large (bigger than 4), then the point
  61. will not be in the set.
  62.  
  63.   When the iteration limit is set to 1000, potentially 1000 such
  64. real values are computed. It turns out that in many cases, there
  65. is a simple cycle among these values. For example, the numbers
  66. might be:
  67.  
  68.     .5 .56 .67 .5 .56 .67  ... etc
  69.  
  70. Once a cycle occurs, there is no point in going though 1000
  71. iterations, since we already know the result. 
  72.  
  73.   Therefore this program uses a simple algorithm (out of Knuth vol II)
  74. to detect such cycles. Detection of cycles reduces somewhat the
  75. amount of computation needed to test the points that actually
  76. lie inside the Mandelbrot set. The cycle detection becomes more
  77. effective when the iteration limit is high.
  78.    
  79. About the program:
  80. -----------------
  81.  
  82.   Running this program should be fairly straight forward.
  83. There are two menus: ACTIONS and DISPLAY. The items
  84. for these menus are summarized below:
  85.  
  86. ACTIONS
  87.   START     - start computation
  88.   SAVE IFF  - save current picture to an IFF file
  89.   CONTROL   - displays the control panel (more on this below)
  90.   COORDINATES - diplays the real coordinates of where the mouse
  91.               points 
  92.   ZOOM      - allows you to zoom into the picture
  93.   ABOUT     - some info about the program
  94.   QUIT      - exit the program
  95.  
  96.  
  97. DISPLAY
  98.   TOGGLE TITLE   - show or hide screen title
  99.   CLEAR          - clear the screen
  100.   CHANGE COLORS  - adjust colors
  101.  
  102.  
  103. Control:
  104. -------
  105.  
  106.    The following items are present in the CONTROL window:
  107.  
  108.    CornerX  - this is the x-coordinate of the upper left
  109.               hand corner of the picture.
  110.    CornerY  - this is the y-coordinate of the upper left
  111.               hand corner of the picture
  112.    PicWidth - the width of the picture shown. Note that the
  113.               aspect ratio is fixed (i.e. the ration of width
  114.           to height), even when zooming.
  115.    ColorDivisor - this number determines how often the color
  116.               changes when the picture is displayed (lower
  117.           number means more changes)
  118.    Iteration Limit - this is a number of iteration per each point;
  119.               maximum number is 1000.
  120.  
  121.  
  122. "CornerX", "CornerY" and "PicWith" are normally left un-touched.
  123. They change when you zoom in. However, you can use these to compute
  124. a particular portion of the set, if you know the coordinates.
  125.  
  126. "ColorDivisor" determines how fast the color changes. This value
  127. should be made larger as you zoom in. This way you will get cleared
  128. bands of color, instead of a mess. However, if you bump the color
  129. divisor to high, the boundary of the entire screen may turn out to be
  130. just one color, and you'll get a blank screen. 
  131.  
  132. I found that it's best to start "ColorDivisor" at 1 or 2, and then
  133. double it for each zoom in.
  134.  
  135. Iteration limit can be 1000 at most. To detect a cycle memory must be
  136. reserved for holding all the computed values, so I chose 1000 as the
  137. maximum. I find that 200 to 300 iteration per point produce pictures
  138. that are ver nice, and don't take more than few hours to produce. 
  139.  
  140. Other stuff:
  141. -----------
  142.  
  143. The "Coordinates" menu item is used to find out coordinates of
  144. points inside the Mandelbrot set. I use these values as inputs
  145. into the Julia Set generating programs.
  146.  
  147. If you have any comments, suggestion or bug reports please
  148. drop me a line. I'm not distributing sources with this program,
  149. but if you'd like to see them let me know and we can arrange
  150. a disk ex-change.
  151.  
  152. =================================================================
  153. Some legal stuff
  154. ---------------
  155.   ****************************************************************
  156.   This program is PUBLIC DOMAIN, that means, you can distribute
  157.   it free of charge as long as this notice is included.
  158.  
  159.       Copyright 1989 (c) by Richie Bielak and Peter Trei
  160.  
  161.   ****************************************************************
  162.  
  163.   This program was written using the Benchmark Modula-2
  164.   system - the best development on the Amiga yet (in my
  165.   opinion).
  166.   
  167.   If you have any comments, questions, suggestions or you've
  168.   found parameters that make pretty pictures drop me a line.
  169.   You can get me:
  170.   
  171.   CIS:     75716,352
  172.   PLINK:   RICHIEB
  173.   SNAIL MAIL: 
  174.        526 79th Street
  175.        Brooklyn, N.Y. 11209
  176.  
  177.  
  178.   Enjoy....Richie
  179.  
  180. ****EOF***EOF****EOF***
  181.